<!-- toaster directive -->
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
<!-- / toaster directive -->

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-href="main"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active" ng-bind="title"></li>
    </ul>
</div>

<!-- 加载提醒 -->
<div ng-show="loading" class="text-center m-t-md text-lg"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>

<!-- 内容区域 -->
<div ng-hide="loading" class="wrapper-md content">
    <!-- 数据显示 -->
    <div class="wrapper-data">
        <div class="panel panel-default">
            <!-- 头部 -->
            <div class="panel-heading clearfix">
                <a ui-sref="main.task.scheduled.update()" class="btn btn-info pull-right">
                    <i class="icon-user-follow m-r-sm text-md"></i>新增任务</a>
                <div class="w-lg">
                    <form ng-submit="search()" class="ng-pristine ng-valid">
                        <div class="input-group search-box">
                            <input type="text" class="form-control" ng-model="param.keyword" placeholder="任务组、任务名称">
                            <i ng-show="user.keyword" ng-click="clearSearch()" class="fa fa-times-circle text-muted search-clear"></i>
                            <span class="input-group-btn">
                                <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>

            <!-- 数据表格 -->
            <div class="table-responsive">
                <table class="table table-striped b-t b-light text-center">
                    <thead>
                    <tr>
                        <th>任务</th>
                        <th>目标对象</th>
                        <th>目标方法</th>
                        <th>执行周期</th>
                        <th>上次执行时间</th>
                        <th>下次运行时间</th>
                        <th>状态</th>
                        <th>&nbsp;</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageInfo.data">
                        <td class="v-middle">{{item.taskDesc}}</td>
                        <td class="v-middle">{{item.targetObject}}</td>
                        <td class="v-middle">{{item.targetMethod}}</td>
                        <td class="v-middle">{{item.taskCron}}</td>
                        <td class="v-middle">{{item.previousFireTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                        <td class="v-middle">{{item.nextFireTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                        <td class="v-middle">
                            <span ng-show="item.status=='NORMAL'" class="text-success">正常</span>
                            <span ng-show="item.status=='PAUSED'" class="text-danger">暂停</span>
                            <span ng-show="item.status=='COMPLETE'" class="text-danger">完成</span>
                            <span ng-show="item.status=='ERROR'" class="text-danger">异常</span>
                            <span ng-show="item.status=='BLOCKED'" class="text-info">堵塞</span>
                        </td>
                        <td class="v-middle">
                            <button type="button" ui-sref="main.task.scheduled.update(item)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-ban m-r-xs text-sm"></i>修改</button>
                            <button type="button" ng-show="item.status=='NORMAL'"  ng-click="disableItem(item.taskGroup, item.taskName,0)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-ban m-r-xs text-sm"></i>暂停</button>
                            <button type="button" ng-show="item.status=='PAUSED'"  ng-click="disableItem(item.taskGroup, item.taskName,1)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-check m-r-xs text-sm"></i>启用</button>
                            <button type="button" ng-show="item.status=='NORMAL'"  ng-click="runItem(item.taskGroup, item.taskName)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-check m-r-xs text-sm"></i>执行</button>
                            <button type="button" ng-click="delItem(item.taskGroup, item.taskName)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-check m-r-xs text-sm"></i>删除</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div><!-- /.table-responsive -->

            <!-- 底部分页 -->
            <footer ng-show="pageInfo.size" class="panel-footer">
                <div class="row">
                    <div class="col-sm-6">
                        <small class="text-muted inline m-t-sm m-b-sm">当前显示{{pageInfo.size}}条 共{{pageInfo.total}}条</small>
                    </div>

                    <div ng-show="pageInfo.size" class="col-sm-6 text-right text-center-xs"
                         paging
                         hide-if-empty=true
                         ul-class="pagination pagination-sm m-t-none m-b-none"
                         page="pageInfo.pageNum"
                         page-size="pageInfo.pageSize"
                         total="pageInfo.total"
                         show-prev-next="true"
                         scroll-top="true"
                         paging-action="pagination(pageInfo.nextPage)">
                    </div>
                </div>
            </footer>

            <!-- 无数据提醒 -->
            <div ng-hide="pageInfo.size" class="m-md alert alert-warning text-center text-lg">暂无数据</div>
        </div><!-- /.panel -->
    </div><!-- /.wrapper-data -->

</div><!-- /.wrapper-md -->